package com.huya.controller.user;


import com.huya.common.result.PageResult;
import com.huya.common.result.Result;
import com.huya.pojo.dto.ReportDTO;
import com.huya.pojo.vo.ReportVO;
import com.huya.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("userReportController")
@RequestMapping("/user/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 添加举报
     * @param reportDTO
     * @return
     */
    @PostMapping()
    public Result addReport(@RequestBody ReportDTO reportDTO) {
        reportService.addReport(reportDTO);
        return Result.success();
    }

    /**
     * 历史举报列表
     * @param page
     * @param pageSize
     * @param status
     * @return
     */
    @GetMapping("/historyReport")
    public Result<PageResult> page(int page, int pageSize, Integer status){
        PageResult pageResult = reportService.pageQueryForUser(page, pageSize, status);
        return Result.success(pageResult);
    }
    @GetMapping("/{id}")
    public Result<ReportVO> getById(@PathVariable("id") Long id) {
        ReportVO reportVO = reportService.getById(id);
        return Result.success(reportVO);
        }
}
